﻿using Microsoft.Extensions.DependencyInjection;
using MiddlewareTest.AppBuilder;
using MiddlewareTest.TestClass;
using System;

namespace MiddlewareTest
{
    class Program
    {
        static void Main(string[] args)
        {
            var serviceCollection = new ServiceCollection();
            serviceCollection.AddTransient<IApplicationBuilder, ApplicationBuilder>(); //It MUST be registered as a transient pattern 
            serviceCollection.AddSingleton<IStartup, Startup>();
            serviceCollection.AddSingleton(new InputClass());

            var serviceProvider = serviceCollection.BuildServiceProvider();

            IStartup start = serviceProvider.GetRequiredService<IStartup>();

            start.StartAsync().Wait();

            Console.WriteLine("Chain end!");

            Console.ReadKey();
        }
    }
}
